summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2023-07-26 03:33:46 +0200
committerMorph <39850852+Morph1984@users.noreply.github.com>2023-07-26 06:41:24 +0200
commit01b379fe20cd0437815e4a8c329fc21b88fdc345 (patch)
treedafd997754fd2f2ca4361b9c829ccbbada7026cf
parentyuzu: Replace httplib with QtNetworkRequest (diff)
downloadyuzu-01b379fe20cd0437815e4a8c329fc21b88fdc345.tar
yuzu-01b379fe20cd0437815e4a8c329fc21b88fdc345.tar.gz
yuzu-01b379fe20cd0437815e4a8c329fc21b88fdc345.tar.bz2
yuzu-01b379fe20cd0437815e4a8c329fc21b88fdc345.tar.lz
yuzu-01b379fe20cd0437815e4a8c329fc21b88fdc345.tar.xz
yuzu-01b379fe20cd0437815e4a8c329fc21b88fdc345.tar.zst
yuzu-01b379fe20cd0437815e4a8c329fc21b88fdc345.zip
-rw-r--r--src/yuzu/discord_impl.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/yuzu/discord_impl.cpp b/src/yuzu/discord_impl.cpp
index 913c7bb99..57b50abd0 100644
--- a/src/yuzu/discord_impl.cpp
+++ b/src/yuzu/discord_impl.cpp
@@ -4,8 +4,10 @@
#include <chrono>
#include <string>
+#include <QEventLoop>
#include <QNetworkAccessManager>
#include <QNetworkReply>
+
#include <discord_rpc.h>
#include <fmt/format.h>
@@ -89,19 +91,15 @@ void DiscordImpl::Update() {
std::string icon_name = GetGameString(game_title);
game_url = fmt::format("https://yuzu-emu.org/images/game/boxart/{}.png", icon_name);
- QNetworkAccessManager* manager = new QNetworkAccessManager();
-
+ QNetworkAccessManager manager;
QNetworkRequest request;
request.setUrl(QUrl(QString::fromStdString(game_url)));
request.setTransferTimeout(3000);
- QNetworkReply* rep = manager->get(request);
-
- QObject::connect(manager, &QNetworkAccessManager::finished,
- [this](QNetworkReply* reply) { UpdateGameStatus(reply->error()); });
- QObject::connect(manager, &QNetworkAccessManager::finished, manager,
- &QNetworkAccessManager::deleteLater);
- QObject::connect(manager, &QNetworkAccessManager::finished, rep,
- &QNetworkReply::deleteLater);
+ QNetworkReply* reply = manager.head(request);
+ QEventLoop request_event_loop;
+ QObject::connect(reply, &QNetworkReply::finished, &request_event_loop, &QEventLoop::quit);
+ request_event_loop.exec();
+ UpdateGameStatus(reply->error());
return;
}